package org.example.service.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.entity.Collection;
import org.example.mapper.CollectionMapper;
import org.example.mapper.PubMapper;
import org.example.service.CollectionService;
import org.example.service.yy.AttractionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collection>  implements CollectionService {
    @Autowired
    private CollectionMapper collectionMapper;

    @Autowired
    private PubMapper pubMapper;

    @Autowired
    private AttractionsService attractionsService;

    @Override
    public Integer addCollection(Integer uid, Integer type, Integer cid) {
        return collectionMapper.addCollection(uid,type,cid);
    }

    @Override
    public Object showList(Integer type, Integer id, Integer uid) {
        Object obj=null;
        switch (type){
            case 2:
                obj=pubMapper.selectPubById(id,uid);
                break;
            case 1:
                obj=attractionsService.selectAttractionsById(id);
        }
        return obj;
    }

}
